<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;

class ShebeiController extends Controller
{
    public function zaotai(){
	if(empty( $_POST)){
		return view('zaotai');
	}else{
		$curl = "http://www.laoyou1.me/gprscmdback.php";
	 	return $this->https2_request( $curl  , $_POST);
		
	}
	
    }
	public function chiyao(){
            if(empty( $_POST)){
              //  return view('chiyao');
       	     }else{
		//$_POST['did'] = 'SIMCOM_SIM800C861694035951225';
		//$_POST['line']='0100';
		//return $_POST;
		//return '123456';
               	 $curl = "http://www.laoyou1.me/gprscmdback_al.php";
               	 return $this->https2_request( $curl  , $_POST);

             }
		//return '22';
   	 }

	
	public function https2_request($url,$data = null){
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
        if (!empty($data)){
                curl_setopt($curl, CURLOPT_POST, 1);
                curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
         }
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        $output = curl_exec($curl);
        curl_close($curl);
        return $output;

    }
}
